package com.atguigu.tingshu.account.client;

import com.atguigu.tingshu.account.service.RechargeInfoService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.account.RechargeInfo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Haoran Sun
 * @since 2024/08/29
 */

@RestController
@RequestMapping("/client/account/rechargeInfo")
public class RechargeInfoClientController {

    @Resource
    private RechargeInfoService rechargeInfoService;

    /**
     * 根据订单号查询充值信息
     * @param orderNo  订单号
     * @return 充值信息
     */
    @GetMapping(value = "/getRechargeInfo/{orderNo}")
    Result<RechargeInfo> getRechargeInfo(@PathVariable("orderNo") String orderNo){
        return Result.ok(rechargeInfoService.getOne(new LambdaQueryWrapper<RechargeInfo>().eq(RechargeInfo::getOrderNo, orderNo)));
    }


}
